import { Form as AntdForm } from 'antd';
import { useForm } from 'antd/lib/form/Form';
import { FormProvider } from 'antd/lib/form/context';
import React from 'react';

import ErrorList from './ErrorList';
import Item from './Item';
import List from './List';

import type { FormProps as AntdFormProps } from 'antd';

export type { FormInstance } from 'antd';
export type { Props as FormErrorListProps } from './ErrorList';
export type { Props as FormItemProps } from './Item';
export type { Props as FormListProps } from './List';

export type FormProps = AntdFormProps;

function Form(props: FormProps) {
  // @ts-ignore
  return <AntdForm {...props} />;
}

Form.Item = Item;
Form.List = List;
Form.ErrorList = ErrorList;
Form.useForm = useForm;
Form.FormProvider = FormProvider;

export { ErrorList, FormProvider, Item, List, useForm };
export default Form;
